import request from '@/utils/http'

// 获取用户资料信息
export function getUserInfoApi(userId) {
  return request({
    url: '/user/getUserList',
    method: 'get',
    params: { userId }
  })
}

// 保存用户修改的信息
export function updateUserApi(data) {
  return request({
    url: '/user/updateUser',
    method: 'put',
    data: data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}


// 获取用户订单列表
export function getUserOrderListApi(userId) {
  return request({
    url: '/order/getOrderList',
    method: 'get',
    params: { userId }
  })
}

//  用户给订单评价
export function addCommentApi(data) {
  return request({
    url: '/comment/addComment',
    method: 'post',
    data: data,
    headers: {
      "Content-Type": "multipart/form-data"
    }
  })
}

// 获取用户订单评价信息
export function getUserCommentApi(commentId) {
  return request({
    url: '/comment/selectCommentById',
    method: 'get',
    params: {commentId}
  })
}

//申请入驻商户
export function applyMerchant(params) {
  return request({
    url: '/user/apply',
    method: 'post',
    data: params
  })
}

// 获取用户地址列表
export function getAddressListAPI(id) {
  return request({
    url: '/address/findByUserId',
    method: 'get',
    params: { id }
  })
}

// 添加地址
export function addAddressAPI(data) {
  return request({
    url: '/address',
    method: 'post',
    data: data
  })
}